//
//  MADareRoundView.m
//  MateAdv
//
//  Created by 茶 on 2023/9/14.
//

#import "MADareRoundView.h"

@interface MADareRoundView ()

@property (nonatomic, strong) UIView *bottomView;
@property (nonatomic, strong) UIView *middleView;
@property (nonatomic, strong) UIView *topView;

@end


@implementation MADareRoundView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initInterface];
    }
    return self;
}

- (void)initInterface {
    _bottomView = [self buildViewWithSize:512 colorStr:@"#FF2E8B"];
    _middleView = [self buildViewWithSize:320 colorStr:@"#FF68AB"];
    _topView = [self buildViewWithSize:214 colorStr:@"#FF9BC7"];
    
}

- (UIView *)buildViewWithSize:(CGFloat)size colorStr:(NSString *)colorStr {
    UIView *view = [UIView new];
    view.layer.cornerRadius = MARatioWidth(size / 2);
    view.layer.masksToBounds = YES;
    view.backgroundColor = MAColor(colorStr);
    [self addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(0);
        make.size.ma_offset(size);
    }];
    return view;
}

- (void)animationEvent {
    [UIView animateWithDuration:0.1 animations:^{
        self.transform = CGAffineTransformMakeScale(1.2, 1.2);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.1 animations:^{
            self.transform = CGAffineTransformMakeScale(0.9, 0.9);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.12 animations:^{
                self.transform = CGAffineTransformMakeScale(1.1, 1.1);
            } completion:^(BOOL finished) {
                [UIView animateWithDuration:0.12 animations:^{
                    self.transform = CGAffineTransformMakeScale(1.0, 1.0);
                }];
            }];
        }];
    }];
}

@end
